package behavioral.iterator;

/**
 * @ClassName: MainTest
 * @Description: 测试类
 * @Author: liu-hao
 * @Date: 2023-04-10 20:48
 * @Version: 1.0
 **/
public class MainTest {
    public static void main(String[] args) {
        MyCollection collection = new MyCollection();
        collection.add("A");
        collection.add("B");
        collection.add("C");

        // 使用迭代器遍历集合
        Iterator iterator = collection.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}
